package two_pointer.leetcode_11;

public class ViolentSolution {
    public int maxArea(int[] height) {
        int maxWater = 0;
        //遍历数组，以 i 为左边界
        for (int i = 0; i < height.length; i++) {
            for (int j = i + 1; j < height.length; j++) {
                //高度取左右边界的较小值
                int h = Math.min(height[i], height[j]);
                //计算当前范围的装水量
                int water = h * (j - i);
                if (water > maxWater) {
                    maxWater = water;
                }
            }
        }
        return maxWater;
    }
}
